﻿using System.Collections.Generic;
using Newtonsoft.Json;

namespace Colorful.Furniture.PermissionManagement;

/// <summary>
///  swagger endPoint 节点JSON
/// </summary>
public class SwaggerApiDto
{
    /// <summary>
    ///  api版本
    /// </summary>
    [JsonProperty("openapi")]
    public string OpenApi { get; set; }

    /// <summary>
    ///  信息
    /// </summary>
    public SwaggerInfoDto Info { get; set; }

    /// <summary>
    ///  api地址
    /// </summary>
    public Dictionary<string, Dictionary<string, dynamic>> Paths { get; set; }

    /// <summary>
    ///  组件
    /// </summary>
    public SwaggerComponentsDto Components { get; set; }
}

/// <summary>
///  swagger信息dto
/// </summary>
public class SwaggerInfoDto
{
    /// <summary>
    ///  标题
    /// </summary>
    public string Title { get; set; }

    /// <summary>
    ///  描述
    /// </summary>
    public string Description { get; set; }

    /// <summary>
    ///  版本号
    /// </summary>
    public string Version { get; set; }
}


/// <summary>
///  swaggerApi相关类
/// </summary>
public class SwaggerComponentsDto
{
    /// <summary>
    ///  构架
    /// </summary>
    public Dictionary<string, SwaggerSchemaObject> Schemas { get; set; }
}

/// <summary>
///  架构对象
/// </summary>
public class SwaggerSchemaObject
{
    /// <summary>
    ///  类型
    /// </summary>
    public string Type { get; set; }

    /// <summary>
    ///  描述
    /// </summary>
    public string Description { get; set; }

    /// <summary>
    ///  其他属性
    /// </summary>
    public bool AdditionalProperties { get; set; }

    /// <summary>
    ///  属性集合
    /// </summary>
    public Dictionary<string, SwaggerSchemaObjectProperty> Properties { get; set; }
}

/// <summary>
///  对象字段
/// </summary>
public class SwaggerSchemaObjectProperty
{
    /// <summary>
    ///  类型
    /// </summary>
    public string Type { get; set; }

    /// <summary>
    ///  格式化
    /// </summary>
    public string Format { get; set; }

    /// <summary>
    ///  描述
    /// </summary>
    public string Description { get; set; }

    /// <summary>
    ///  是否为空
    /// </summary>
    public bool Nullable { get; set; }
}
